/*---------------------------------------------------------------------------------

	by GugloPWN

---------------------------------------------------------------------------------*/

#ifndef BLOCK_H
#define BLOCK_H

#include <nds.h>
#include <stdio.h>
#include <string.h>
#include "MD2.h"



struct point{
	int x;
	int y;
	int z;
};

struct rail{
	point a;
	point b;
};

class block {

	public:

	block() {getdefaultblock();}
	block(char path[64]) {readblock(path);}
	void readblock(char path[64]);
	
	void writeblock(char path[64]);

	void gettestblock();
	void getdefaultblock();
	void getnullblock();
	
	void loadblockmodel();
	
	void drawblock();
	void drawblockcolmap();
	
	inline int getbase(int i, int j) {return base[i][j];}
	inline int getplat(int i, int j) {return plat[i][j];}
	inline rail getrail(int i) {return rails[i];}
	
	
	private:
	
	int base[20][20];
	int plat[20][20];
	rail rails[16];
	
	//MD2 stuff
	
	int Texture[1];
	int TexturePal[1];
	int textsize;
	MD2Entity Model;
	bool ModelEnable;
	
};


#endif


